// 写一个Result封装，用类实现,code,message,status
class Result<T> {
  code: number;
  message: string;
  status: boolean;
  data: T;
  constructor(code: number, message: string, status: boolean, data: T) {
    this.code = code;
    this.message = message;
    this.status = status;
    this.data = data;
  }
  static success(data: any) {
    return new Result(200, 'success', true, data);
  }
  static error(message: string, code: number = 500) {
    return new Result(code, message, false, null);
  }
}

export { Result };
